#include <iostream.h>
#include "Account.h"
//declaring the function prototype
void Bankbanner();
int main()
{
//defining program identifiers
int in,out;
char choice ='Y',transaction;
//declaring student object for osama with a balance of $0
Account osama;
//calling the function to display the Bank Banner
Bankbanner();
//Going into Transaction loop
while (choice =='Y'&& choice !='N')
{ // Prompting the user for Transactions through a switch statement
cout<<" To make a Deposit press + or To make a Withdrawal press - :";
cin>> transaction;
switch (transaction)
{
case '+':
cout<< " Enter your deposit: ";
cin>>in;
osama.deposit(in);
cout<< " Your Balance is: $"<<osama.balance()<<endl;
break;
case '-':
cout<< " Amount to be withdrawn: ";
cin>>out;
osama.withdraw(out);
cout<< " Your Balance is: $"<<osama.balance()<<endl;
break;
default:
cout<< "Error! Operation should be + or - only "<<endl;
break;
}
//Prompting user whether he/she wishes to make another transaction
cout<< " To make another transaction press Y otherwise press N to exit: ";
cin>>choice;
cout<<endl;
if (choice !='Y')
{
cout<<endl<<" Have a good day "<<endl<<endl;
}
}
return 0;
}
// Implementation of the Free Function
void Bankbanner()
{
//Displaying the Bank Banner
cout<<"**********************************************"<<endl;
cout<<"**** Welcome to the Osama Financial group ****"<<endl;
cout<<"**********************************************"<<endl;
cout<<endl;
}
//Run Solution 1:
/*
**********************************************
**** Welcome to the Osama Financial group ****
**********************************************
To make a Deposit press + or To make a Withdrawal press - :+
Enter your deposit: 500
Your Balance is: $500
To make another transaction press Y otherwise press N to exit: Y
To make a Deposit press + or To make a Withdrawal press - :-
Amount to be withdrawn: 250
Your Balance is: $250
To make another transaction press Y otherwise press N to exit: Y
To make a Deposit press + or To make a Withdrawal press - :-
Amount to be withdrawn: 475
Your Balance is: $0
To make another transaction press Y otherwise press N to exit: N
Have a good day
Press any key to continue
*/
|